package com.itheima.edu.info.manager.controller;

import com.itheima.edu.info.manager.domain.Fruit;

import java.util.Scanner;

public class ManagerController extends BaseManagerController{
    private Scanner sc = new Scanner(System.in);

    // 键盘录入水果信息
    // 开闭原则: 对扩展内容开放, 对修改内容关闭
    @Override
    public Fruit inputFruitInfo(String id) {
        System.out.println("请输入水果名称:");
        String name = sc.next();
        System.out.println("请输入水果价格:");
        String price = sc.next();
        System.out.println("请输入水果库存:");
        String inventory = sc.next();
        Fruit fruit = new Fruit();
        fruit.setId(id);
        fruit.setFruitName(name);
        fruit.setFruitPrice(Integer.parseInt(price));
        fruit.setInventory(Integer.parseInt(inventory));
        return fruit;
    }
}
